#!/usr/bin/python
#coding:utf-8

#windows and linux have different end line mark

import re

file_object = open('output.csv','r+')
d = {'watch_num': 0,\
    'star_num': 0,\
    'fork_num': 0,\
    'pulls_open_num': 0,\
    'pulls_closed_num': 0,\
    'pulls_total_num': 0,\
    'total_commits_num': 0,\
    'latest_commits_num': 0,\
    'average_commits_num': 0,\
    'code_last_three_month_added': 0,\
    'baidu_search_num': 0,\
    'digital_book_num': 0,\
    'book_num': 0,\
    'csdn_blog_num': 0,\
    'soopat_num': 0,\
    'baidu_xueshu_num': 0,\
    'bing_academic_num': 0,\
    'wanfang_num': 0,\
    'cnblogs_num': 0,\
    'iteye_num': 0,\
    'itpub_num': 0,\
    'cnki_num': 0,\
    'oschina_num': 0,\
    'chinaunix_num': 0,\
    'cnnvd_num': 0,\
    '51cto_num': 0,\
    'stackoverflow_num': 0
    }

#当问号出现在表现不定次数的正则表达式部分之后时，就表示非贪婪匹配。
pattern = re.compile(r'^[^,]*')

for line in file_object:
    match = pattern.match(line)
    if match:
        d[match.group()] = 1

for key,value in d.items():
    if value == 0:
        wstr = key + ',None\n'
        file_object.write(wstr)